home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10774 < prev    next >
Encoding:
Text File  |  1996-08-05  |  963 b   |  27 lines

  1. Newsgroups: comp.lang.c
  2. Path: news.sprintlink.net!news1!ind-004-236-178
  3. From: dlmiller@iquest.net (Doug Miller)
  4. Subject: Re: 16-bit memset?
  5. X-Nntp-Posting-Host: ind-004-236-178.iquest.net
  6. Message-ID: <DoJABC.Hy7@iquest.net>
  7. Sender: news@iquest.net (News Admin)
  8. Organization: IQuest Network Services
  9. X-Newsreader: News Xpress Version 1.0 Beta #2.1
  10. References: <joules-1803962243060001@badboy.mit.edu> <4ill6r$qnm@nntp.interaccess.com>
  11. Date: Tue, 19 Mar 1996 21:30:39 GMT
  12.  
  13. +Julian Orbanes wrote:
  14. +>I am looking quick way to set a series of 16-bit values to one value.
  15. +>
  16. +>Analagous to how memset set works with 8-bit values. (For graphics
  17. +>purposes).
  18.  
  19. char    *bigstuff;
  20.  . .
  21. /* assuming that:                                */
  22. /*    1) you have allocated storage for bigstuff                */
  23. /*    2) it is a null-terminated string of the desired FINAL length            */
  24. /*    3) you have loaded the value you wish to propagate into the first 2 bytes    */
  25.  
  26. strncpy (bigstuff + 2, bigstuff, (strlen (bigstuff) - 2));
  27.